package com.wanmait.wisdom.web.controller;

import com.auth0.jwt.exceptions.JWTVerificationException;
import com.wanmait.wisdom.util.AjaxResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//@RestControllerAdvice
//@ControllerAdvice
public class WebResidentControllerAdvice {
    @ExceptionHandler(Exception.class)
    //@ResponseBody
    public AjaxResult processException(Exception e){
        return AjaxResult.error(e.getMessage());
    }

    @ExceptionHandler(JWTVerificationException.class)
    public AjaxResult processJWTVerificationException(JWTVerificationException e){
        return AjaxResult.error(10002,e.getMessage());
    }
}
